'''爬取搜狗电影排行'''
import requests
import json

if __name__=="__main__":
    headers={
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0',
        'Referer': 'https://fanyi.baidu.com/',#关键头：标记请求来源
        'Accept-Language': 'zh-CN,zh;q=0.9',# 关键头：语言设置
    }
    #指定url
    url="https://movie.douban.com/j/chart/top_list"
    prama={
        'type': '5',
        'interval_id': '100:90',
        'action':'' ,
        'start': '0',
        'limit': '100'
    }
    #发起请求
    response=requests.get(url=url,params=prama,headers=headers)
    print(response)
    #获取响应数据
    list_data = response.json()
    #持久化存储
    fp = open("./movie.json","w",encoding="utf-8")
    json.dump(list_data,fp=fp,ensure_ascii=False)
    print("over")